{% extends "layout.html" %}
{%block stylesheets%}
{{super()}}
{{css('items/form')}}
{%endblock%}
{%block javascript%}
{{super()}}
{{js('image-editing')}}
{{js('rich-text')}}
{%endblock%}
{%block content%}
<div id="thumbnail" class="image-editable" {%if item_picture%}style="background-image:url('{{item_picture}}')"{%endif%} data-sizes="512" data-field-name="picture" data-form="main-form">
	<div>Drag Picture Here</div>
</div>
<form method="post" data-completing-label="Submitting..." id="main-form">
	{%if errors %}
	<div id="errors">
		<div>The following must be fixed:</div>
		<ul>
		{%for err in errors%}
			<li>{{err}}</li>
		{%endfor%}
		</ul>
	</div>
	{%endif%}
	{{csrf_field()}}
	<div class="field">
		<label for="name">Name:</label>
		<input type="text" name="name" value="{{item_name|default}}"/>
	</div>
	<div class="field">
		<label for="price">Price:</label>
		<input type="text" name="price" value="{{item_price|default}}"/>
	</div>
	<div class="expiration">This item will expire on {{convert_datetime(item_expiry)|date}}</div>
	<label for="description">Description:</label>
	<textarea name="description"></textarea>
	<div class="rich-text" data-form="main-form" data-field="description">{{item_description|Markup}}</div>
	<div class="actions">
		<a href="{{current_user|url}}">Back to My Items</a>
		<input type="submit" value="Submit"/>
	</div>
	{%if item_picture_data%}
	<input type="hidden" name="picture_512" value="{{item_picture_data}}"/>
	{%endif%}
</form>
<div id="clearer"></div>
{%endblock%}